[GHA] Fix OIDC publish, unify top-level package-publishing workflows#57255
Closed
robhogan wants to merge 1 commit into
Closed
[GHA] Fix OIDC publish, unify top-level package-publishing workflows#57255robhogan wants to merge 1 commit into
robhogan wants to merge 1 commit into
Conversation
…npm.yml ## Problem npm Trusted Publishing matches the `workflow_ref` OIDC claim, which is always the top-level workflow filename. npm allows only ONE trusted publisher per package. The prior migration (#57099) used `workflow_call` to route all publishes through `publish-npm.yml`, but `workflow_ref` resolves to the *caller* (e.g. `nightly.yml`), not the reusable child — so the Trusted Publisher entry for `publish-npm.yml` never matches. ## Solution Merge all three publish entry points into `publish-npm.yml` itself, triggered by all three event types: - `push.tags: v0.*` → release mode (was publish-release.yml) - `schedule + workflow_dispatch` → nightly mode (was nightly.yml) - `push.branches: main, *-stable` → bumped-packages mode (was publish-bumped-packages.yml) A `determine_mode` job inspects the trigger and sets the mode. Downstream jobs use conditional `if:` expressions to run only the relevant build/publish steps. Since `publish-npm.yml` is now always the top-level workflow, `workflow_ref` always resolves to `publish-npm.yml` ✅. ## Key design points - **No JS changes** — the publish scripts are unchanged. The build and publish still happen in the same job, on the same runner, with the same container. No artifact handoff or pack-only mode needed. - **Reusable workflow_call children are fine** — prebuild-ios-*.yml, generate-changelog.yml, etc. remain as `workflow_call` children. Only the file that calls `npm publish` must be the top-level workflow; child workflows don't affect the OIDC claim. - **Old workflow files kept as stubs** — publish-release.yml, nightly.yml, and publish-bumped-packages.yml are replaced with minimal deprecation notices so that external links/dashboards don't 404. - **`always()` + explicit result checks** — publish_react_native depends on build_android (nightly-only) and prebuild_* jobs. In release mode, build_android is skipped. The `always()` prevents cascading skips, while explicit result checks ensure we don't publish after a failed build. ## npm Trusted Publisher config (manual step) For each of the 24 packages, configure on npmjs.com: Organization: react Repository: react-native Workflow: publish-npm.yml Environment: npm-publish
|
@robhogan has imported this pull request. If you are a Meta employee, you can view this in D108894981. |
|
Warning Missing Test Plan Please add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested. |
cortinico
approved these changes
Jun 17, 2026
cortinico
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
npm Trusted Publishing matches the
workflow_refOIDC claim, which is always the top-level workflow filename. npm allows only ONE trusted publisher per package. The prior migration (#57099) usedworkflow_callto route all publishes throughpublish-npm.yml, butworkflow_refresolves to the caller (e.g.nightly.yml), not the reusable child, so the Trusted Publisher entry forpublish-npm.ymlnever matches.Solution
Merge all three publish entry points into
publish-npm.ymlitself, triggered by all three event types:push.tags: v0.*-> release mode (was publish-release.yml)schedule + workflow_dispatch-> nightly mode (was nightly.yml)push.branches: main, *-stable-> bumped-packages mode (was publish-bumped-packages.yml)A
determine_modejob inspects the trigger and sets the mode. Downstream jobs use conditionalif:expressions to run only the relevant build/publish steps.Since
publish-npm.ymlis now always the top-level workflow,workflow_refalways resolves topublish-npm.yml, which matches what's already configured on npm.